﻿/*******************************************************************   
 * 创建日期：2021.07.09 11:00:39  
 * 创 建 者：Administrator 
 * 功能描述：移动能力接口 
 *******************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cars
{
    public struct Position 
    {
        public int x;
        public int y;

        public Position(int x , int y)
        {
            this.x = x;
            this.y = y;
        }

        public static Position operator +(Position a, Position b)
        {
            return new Position(a.x + b.x, a.y + b.y);
        }

        public static Position operator -(Position a, Position b)
        {
            return new Position(a.x - b.x, a.y - b.y);
        }

        public static Position left => new Position(-1, 0);
        public static Position right => new Position(1, 0);
        public static Position up => new Position(0, 1);
        public static Position down => new Position(0, -1);
        public static Position zero => new Position(0, 0);
        public static Position one => new Position(1, 1);
    }

    interface IMoveable
    {
        void Move(Position deltaPos);
    }
}
